//
//  DJDetailAlbumTableViewCell.m
//  CoolFM
//
//  Created by 曹曹 on 16/9/5.
//  Copyright © 2016年 曹曹. All rights reserved.
//

#import "DJDetailAlbumTableViewCell.h"
#import "AlbumRoot.h"
#import "AlbumRecord.h"
#import "AlbumRecord_Plays.h"
#import "AlbumRecord_Dj_Info.h"
#import "UIImageView+WebCache.h"
#import "NSString+ListenNums.h"
#import "DJDetailBannerViewController.h"
#import "DJDetailViewController.h"

@interface DJDetailAlbumTableViewCell ()

// record_play_image_url
@property (weak, nonatomic) IBOutlet UIImageView *picView;
// record_name
@property (weak, nonatomic) IBOutlet UILabel *recordName;
// record_play_description
@property (weak, nonatomic) IBOutlet UILabel *recordDescription;
// record_play_listen_amount
@property (weak, nonatomic) IBOutlet UILabel *recordListenNums;
// record_play_nums
@property (weak, nonatomic) IBOutlet UILabel *recordPlayNums;
// vc
@property (nonatomic, strong) DJDetailViewController *vc;

@end

@implementation DJDetailAlbumTableViewCell

#pragma mark - model setter
- (void)setRecordPlays:(AlbumRecord_Plays *)recordPlays {
    _recordPlays = recordPlays;
    [_picView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@", _recordPlays.record_play_image_url]] placeholderImage:[UIImage imageNamed:@"img_dj_head"]];
    _recordName.text = _recordPlays.record[0].record_name;
    _recordDescription.text = _recordPlays.record_play_description;
    _recordListenNums.text = [NSString stringWithFormat:@"人气: %@", [NSString listenNumStringWithInteger:_recordPlays.record_play_listen_amount]];
    _recordPlayNums.text = [NSString stringWithFormat:@"%ld期", recordPlays.record_play_nums];
}

#pragma mark - 点击cell显示详情
- (IBAction)moreDetailButtonClicked:(id)sender {
    DJDetailBannerViewController *djDetailBannerVC = [[DJDetailBannerViewController alloc] init];
    djDetailBannerVC.playKey = _recordPlays.record_play_key;
    [self.vc.navigationController pushViewController:djDetailBannerVC animated:YES];
}
#pragma mark - 获取控制器
- (DJDetailViewController *)vc {
    id responder = self.nextResponder;
    while (![responder isKindOfClass:[DJDetailViewController class]] && responder != nil) {
        responder = [responder nextResponder];
    }
    return (DJDetailViewController *)responder;
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
